package yl.hs.bmipfull.security;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import yl.hs.bmipfull.pojo.production.ProductionLineEntity;
import yl.hs.bmipfull.utils.Tl;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 张凯
 * @apiNote 主机身份验证
 * @since 21-7-1 上午 11:01 创建
 */

public class HostValidation {


    public static ProductionLineEntity getLine(){
        RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
        var sra  = (ServletRequestAttributes)requestAttributes;
        var request =	sra.getRequest();
        var obj =request.getSession().getAttribute("line");
        if(obj!=null){
            return (ProductionLineEntity) obj;
        }
        return null;
    }
}
